package com.fs.chatx.module.knowledge.config;

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "milvus") // 绑定配置前缀
public class MilvusConfig
{

    private String url; // 仅需主机名或 IP（如 "localhost"）
    private String dbName;
    private String token;

    @Bean
    public MilvusClientV2 milvusClient()
    {
        // Connect to Milvus server
        ConnectConfig connectConfig = ConnectConfig.builder()
                .uri(url) // 获取的 Milvus 链接端点
                .token(token)
               .dbName(dbName)
                .build();
        return  new MilvusClientV2(connectConfig);
    }


}
